var mongoose = require('mongoose');
var session = require('express-session');
var MongoStore = require('connect-mongo')(session);

var config = require('../data/config.json');

mongoose.connect('mongodb://localhost/wechat');

/**
 * Applies configurations settings
 * for application.
 *
 * @param {Express} app `Express` instance.
 * @api public
 */
exports.get = function(key){

	var module = {
		'mongoose' : mongoose ,
		'session' : session ,
		'MongoStore' : MongoStore ,
	};

	return module[key];
}

exports.set = function(key, app){

	var module = {
		'config' : config ,
	};

	app.set(key, module[key]);
}
